package com.itheima.mapper;

import com.itheima.pojo.Assignment;
import com.itheima.pojo.AssignmentFinishTimes;
import com.itheima.pojo.UserAssignment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

@Mapper
public interface AssignmentMapper {

    @Insert("insert into ssm_db.assignment(id,user_id,name ,memo ,type,created_on) values(null,userId,name ,memo ,type,createdOn)")
    int addAssignment(Assignment assignment);

    List<UserAssignment> findStudentAssignmentByTimeAndType(@Param("time") Date time, @Param("type") Long type);


    List<AssignmentFinishTimes>findStudentFinishTimesByClassIdAndTypeAndTime(@Param("classId") Long classId,
                                                                  @Param("type") Integer type,
                                                                  @Param("startTime") Date startTime,
                                                                  @Param("endTime") Date endTime);


}
